version: '3.5'

services:
  authorization-file-manager:
    container_name: authorization-file-manager
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DB=authorization
    image: postgres:13.11-bullseye
    ports:
      - '5434:5432'
    volumes:
      - authorization:/var/lib/postgresql/authorization
  file-manager-file-system:
    container_name: file-manager-file-system
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DB=file_manager
    image: postgres:13.11-bullseye
    ports:
      - '5433:5432'
    volumes:
      - file_manager:/var/lib/postgresql/file_manager
#  authorization-microservice:
#    container_name: authorization-microservice
#    build:
#      context: ./authorization-microservice
#    depends_on:
#      - kafka
#    ports:
#      - "9200:9200"
#    environment:
#      - SPRING_DATASOURCE_USERNAME=postgres
#      - SPRING_DATASOURCE_PASSWORD=postgres
#      - SPRING_DATASOURCE_URL=jdbc:postgresql://authorization-file-manager:5432/authorization
#      - SPRING_KAFKA_BOOTSTRAP_SERVERS=kafka-file-manager:9092
#  file_manager:
#    container_name: file_manager
#    build:
#      context: ./file_manager
#    depends_on:
#      - kafka
#    ports:
#      - "9000:9000"
#    environment:
#      - SPRING_DATASOURCE_USERNAME=postgres
#      - SPRING_DATASOURCE_PASSWORD=postgres
#      - SPRING_DATASOURCE_URL=jdbc:postgresql://file-manager-file-system:5432/file_manager
#      - SPRING_KAFKA_BOOTSTRAP_SERVERS=kafka-file-manager:9092
#     - SERVICE_AUTHENTICATION_IS-AUTHENTICATION_HOST=authorization-microservice
  zookeeper-file-manager:
    restart: always
    container_name: zookeeper-file-manager
    image: zookeeper:latest
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
      ZOOKEEPER_TICK_TIME: 2000
      ZOOKEEPER_SERVER_ID: 1
    ports:
      - "22181:2181"
    volumes:
      - zookeeper:/var/lib/zookeeper
  kafka-file-manager:
    restart: always
    container_name: kafka-file-manager
    image: bitnami/kafka:latest
    depends_on:
      - zookeeper-file-manager
    ports:
      - "29092:29092"
    volumes:
      - kafka:/var/lib/kafka
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: zookeeper-file-manager:2181
      KAFKA_LISTENERS: PLAINTEXT://:9092,PLAINTEXT_HOST://:29092
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka-file-manager:9092,PLAINTEXT_HOST://192.168.0.107:29092
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
      KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1


volumes:
  authorization:
  file_manager:
  kafka:
  zookeeper:
